package org.evej.apiparser.model.account;

import org.evej.apiparser.model.ApiDocumentModel;

import java.util.Date;

public class ApiAccount implements ApiDocumentModel {

    private static final long serialVersionUID = 7692398382L;

    private final int logonMinutes;
    private final int logonCount;
    private final Date createDate;
    private final Date paidUntil;

    private ApiAccount(int logonMinutes, int logonCount, Date createDate, Date paidUntil) {
        this.logonMinutes = logonMinutes;
        this.logonCount = logonCount;
        this.createDate = new Date(createDate.getTime());
        this.paidUntil = new Date(paidUntil.getTime());
    }

    public int getLogonMinutes()  {
        return logonMinutes;
    }

    public int getLogonCount() {
        return logonCount;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public Date getPaidUntil() {
        return paidUntil;
    }

    public static class Builder {

        private int logonMinutes;
        private int logonCount;
        private Date createDate;
        private Date paidUntil;

        public Builder setLogonMinutes(int logonMinutes) {
            this.logonMinutes = logonMinutes;
            return this;
        }

        public Builder setLogonCount(int logonCount) {
            this.logonCount = logonCount;
            return this;
        }

        public Builder setCreateDate(Date createDate) {
            this.createDate = createDate;
            return this;
        }

        public Builder setPaidUntil(Date paidUntil) {
            this.paidUntil = paidUntil;
            return this;
        }

        public ApiAccount build() {
            return new ApiAccount(logonMinutes, logonCount, createDate, paidUntil);
        }
    }

}
